package bankaccount;

public class SavingAccount extends BankAccount {
    private double interestRate;

    public SavingAccount(String accountNumber, String accountHolder, double balance, double interestRate) {
        super(accountNumber, accountHolder, balance);
        this.interestRate = interestRate;
    }

    @Override
   public String accountType() {
        return "Saving";
    }

    public void calculateInterest(){
        double interest = interestRate * this.getBalance();
        System.out.println("利息为"+interest);
        this.setBalance(getBalance()+interest);
    }
}
